package com.pxxy.mall.search.controller;

import com.pxxy.mall.search.service.MallSearchService;
import com.pxxy.mall.search.vo.SearchParam;
import com.pxxy.mall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @Author zhangjj
 * @since 2024/1/27
 */
@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;


    //TODO 这个接口后续补全
    @GetMapping({"/list.html", "/"})
    public String toIndex(SearchParam searchParam, Model model) {
        SearchResult searchResult = mallSearchService.search(searchParam);
        model.addAttribute("result", searchResult);
        return "list";
    }


}
